<include file='Common:header'/>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            菜单管理
            <small></small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="{:U('Index/index')}"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">菜单管理</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">

        <!-- START CUSTOM TABS -->
        <div class="row">
            <div class="col-xs-12">
                <!-- Custom Tabs -->
                <div class="nav-tabs-custom">

                    <ul class="nav nav-tabs">

                        <li class="active"><a href="#tab_detail" data-toggle="tab" rel="tab_detail">菜单列表</a></li>
                        <li><a href="javascript:void(0)" onclick="addData()">添加菜单</a></li>

                        <li class="pull-right"><a href="javascript:void(0)" onclick="addData()" class="text-muted"><i class="fa fa-gear"></i></a></li>
                    </ul>

                    <div class="tab-content">

                        <div class="tab-pane active" id="tab_detail">


                            <div style="width:100%;">
                                <form role="form" method="post" action="{:U('updateOrder')}">
                                <div class="box">
                                    <div class="box-header with-border">
                                        <h3 class="box-title">菜单列表</h3>
                                    </div><!-- /.box-header -->
                                    <div class="box-body no-padding">

                                        <div class="col-xs-12">
                                            <!-- general form elements -->
                                            <div class="box box-primary">

                                                <table class="table table-condensed table-hover">
                                                    <tbody><tr>
                                                        <th style="width: 50px">排序</th>
                                                        <th style="width: 50px">ID</th>
                                                        <th>菜单名称</th>
                                                        <th style="width: 120px">控制器</th>
                                                        <th style="width: 120px">动作</th>
                                                        <th class="text-center">状态</th>
                                                        <th>类型</th>
                                                        <th class="text-center" style="width: 180px">操作</th>
                                                    </tr>

                                                    <volist name="node" id="n">
                                                        <tr>
                                                            <td>
                                                                <input type="text" class="took-w50" value="{$n.list_order}" name="list_order[{$n.nid}]"/>
                                                            </td>
                                                            <td class="took-w60">{$n.nid}</td>
                                                            <td>{$n._name}</td>
                                                            <td>{$n.controller}</td>
                                                            <td>{$n.action}</td>
                                                            <td class="res-status text-center" data-url="{:U('setStatus')}" data-id="{$n.nid}" data-status-ok="显示" data-status-no="隐藏">
                                                                <if condition="$n[is_show] eq 1">
                                                                        <span data-toggle="tooltip" title="显示">
                                                                            <i class="icon fa fa-check text-green"></i>
                                                                        </span>
                                                                    <else/>
                                                                        <span data-toggle="tooltip" title="隐藏">
                                                                            <i class="icon fa fa-close text-red"></i>
                                                                        </span>
                                                                </if>
                                                            </td>
                                                            <td>
                                                                <if condition="$n[type] eq 1">
                                                                    <font color="blue">权限菜单</font>
                                                                    <else/>
                                                                    普通菜单
                                                                </if>
                                                            </td>
                                                            <td class="text-center">
                                                                <if condition="$n[_level] eq 3">
                                                                    <i class="glyphicon glyphicon-plus icon-plus text-gray"></i> &nbsp;
                                                                    <else/>
                                                                    <a href="javascript:void(0)" onclick="addData({$n.nid})" title="添加子菜单"><i class="glyphicon glyphicon-plus icon-plus"></i></a> &nbsp;
                                                                </if>

                                                                <if condition="$n[is_system] eq 0">
                                                                    <a href="javascript:void(0)" onclick="editData({$n.nid})" title="修改"><i class="glyphicon glyphicon-edit"></i></a> &nbsp;
                                                                    <a href="javascript:void(0)" onclick="del({$n.nid})" title="删除"><i class="glyphicon glyphicon-trash"></i></a>
                                                                    <else/>
                                                                    <i class="glyphicon glyphicon-edit"></i> &nbsp;
                                                                    <i class="glyphicon glyphicon-trash text-gray"></i>
                                                                </if>
                                                            </td>
                                                        </tr>
                                                    </volist>

                                                    </tbody></table>

                                            </div><!-- /.box -->


                                        </div>

                                        <div class="box-footer">
                                            <button class="btn btn-primary" type="submit">排序</button>
                                        </div>

                                    </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                </form>

                            </div>
                        </div><!-- /.tab-pane -->

                    </div><!-- /.tab-content -->


                </div><!-- nav-tabs-custom -->
            </div><!-- /.col -->

        </div> <!-- /.row -->
        <!-- END CUSTOM TABS -->

    </section><!-- /.content -->
</div><!-- /.content-wrapper -->

<script>
    //添加
    function addData(id) {
        id = isNaN(id) ? '' : id;
        var title = '添加菜单';
        var url = "{:U('add',array('pid'=>''))}" + id;
        ajaxForm(url, title);
    }

    //编辑
    function editData(id) {
        var title = '编辑菜单';
        var url = "{:U('edit',array('nid'=>''))}" + id;
        ajaxForm(url, title);
    }

    //删除
    function del(id) {
        delItem("{:U('del')}", {nid: id});
    }
</script>

<include file='Common:footer'/>